package type;

/**
 * @Date 2021/4/29 11:17 上午
 * @Author dengxin
 */
public class ClassInitial {

    static class Candy {
        static {
            System.out.println("initial Candy");
        }
    }

    static class Tom {
        static {
            System.out.println("initial Tom");
        }
    }

    static class Jack {
        static {
            System.out.println("Initial Jack");
        }
        public Jack() {
            System.out.println("Construction Jack");
        }
    }

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        System.out.println("Inside main method");
        new Candy();
//        Class.forName("Tom");
        Jack jack = new Jack();
        Class<?> clazz = jack.getClass();
        Jack jack1 = (Jack) clazz.newInstance();
        Class<?> superClazz = clazz.getSuperclass();
        System.out.println("Type of Jack's SuperClass is : " + superClazz);
    }
}
